package com.imachen.ymcc.fallback;

import com.imachen.ymcc.enums.GlobalExceptionCode;
import com.imachen.ymcc.fegin.CourseFeignClien;
import com.imachen.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignClienFallbackFactory implements FallbackFactory<CourseFeignClien> {
    @Override
    public CourseFeignClien create(Throwable throwable) {
        return new CourseFeignClien() {
            @Override
            public JSONResult getCourseOrderInfo(String courseIds) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR);
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR);
            }
        };
    }
}
